from typing import List
from fastapi import APIRouter

from database.model import Chapter
from .model import ChapterModel

router=APIRouter(
    tags=['chapter'],
    prefix='/chapter')

@router.get('/subjects',response_model=List[ChapterModel])
def get_subjects():
    return list(Chapter.select().where(Chapter.id<1000))

@router.get('/{chapter_id}',response_model=ChapterModel)
def get_chapter(chapter_id:int):
    return Chapter.get_by_id(chapter_id)

